<%--
  Created by IntelliJ IDEA.
  User: jqy
  Date: 2023/12/9
  Time: 17:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="cn.sqlexperiment.web.classes.RoundData" %>

<html>
<head>
  <title>student</title>
  <style>
    .box {
      width: 1000px;
      /* 超出部分隐藏 */
      overflow: hidden;
      margin: auto;
      display: flex;
      background-color: #E1E9EF;
    }

    .content {
      width: 1000px;
      height: 600px;
      flex-shrink: 0;
    }

    .table11_3{
      width: 1000px;
      height: 600px;
    }
    .table11_3 table {
      margin:40px 20px;
      border:0;
    }
    .table11_3 th {
      background-color:#FF5675;
      color:#FFFFFF
    }
    .table11_3,.table11_3 th,.table11_3 td {
      font-size:0.95em;
      text-align:center;
      padding:4px;
      border-collapse:collapse;
    }
    .table11_3 th,.table11_3 td {
      border: 1px solid #fe2047;
      border-width:1px 0 1px 0;
      border:2px inset #ffffff;
    }
    .table11_3 tr {
      border: 1px solid #ffffff;
    }
    .table11_3 tr:nth-child(odd){
      background-color:#fec6d1;
    }
    .table11_3 tr:nth-child(even){
      background-color:#ffffff;
    }
  </style>
</head>
<body>

<section>
  <div class="box">
    <%
      Class.forName("com.mysql.jdbc.Driver");
      String url = "jdbc:mysql://localhost:3306/hospital";
      String name = "root";
      String password = "12345";
      request.setCharacterEncoding("UTF-8");
      Connection conn = DriverManager.getConnection(url, name, password);
      String wardno = request.getParameter("wardno");
      String sql = "SELECT nurse.nur_name, wardround.* FROM nurse, wardround WHERE round_ward_no = ? AND nur_no = (SELECT wardround.round_nur_no FROM wardround WHERE round_ward_no = ?)";
      PreparedStatement stmt = conn.prepareStatement(sql);
      stmt.setString(1, wardno);
      stmt.setString(2, wardno);
      ResultSet rs = stmt.executeQuery();
      String nur_name = new String();
      String round_ward_no = new String();
      String situation = new String();
      int i = 0;
      while (rs.next()) {
        nur_name=rs.getString("nur_name");
        round_ward_no=rs.getString("round_ward_no");
        situation=rs.getString("situation");
        i++;
        String c = String.valueOf(i);
    %>
    <div id="<%=c%>" class="content">
      <table class=table11_3>
        <tr>
          <td>
            护士姓名
          </td>
          <td>
            病房号
          </td>
          <td>
            查房情况
          </td>
        </tr>
        <tr>
          <td>
            <%=nur_name%>
          </td>
          <td>
            <%=round_ward_no%>
          </td>
          <td>
            <%=situation%>
          </td>
        </tr>
      </table>
    </div>
    <%
      }
    %>

  </div>
</section>
<%
  for (int j = 1; j <= i; j++) {
    StringBuilder sb = new StringBuilder();
    sb.append("#").append(String.valueOf(j));
    String c = new String(sb);
%>
<p><a href="<%=c%>" id="nav1"><%=c%>
</a></p>
<%
  }
  rs.close();
  stmt.close();
  conn.close();
%>
</body>
</html>

